FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04

RUN apt-get clean
RUN gpg --keyserver keyserver.ubuntu.com --recv-keys F60F4B3D7FA2AF80
RUN apt-get update
RUN apt-get -y install python3 python3-pip zsh gcc-8 g++-8
RUN apt-get -y install wget git apt-utils sudo cmake vim

RUN pip3 install torch==1.7.1+cu101  -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.mirrors.ustc.edu.cn/simple

RUN useradd -m -p lmy -s /bin/zsh lmy
RUN usermod -a -G sudo lmy

RUN mkdir /home/lmy/gnswitch
WORKDIR /home/lmy/
RUN sudo -u lmy wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh && \
    sed -i "s/github/gitee/g; s/ohmyzsh\/ohmyzsh/mirrors\/oh-my-zsh/g" install.sh && \
    sh install.sh

WORKDIR /home/lmy/gnswitch
COPY GSWITCH ./GSWITCH
COPY torch_grad_test ./torch_grad_test
COPY CMakeLists.txt ./
RUN chown -R lmy /home/lmy
